﻿@using EMRI.EmergencyCare.Web.Helper
@model EMRI.EmergencyCare.Web.Helper.PatientDetailsViewModel
@{
    ViewBag.Title = "Patient Entry";
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { @enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    @Html.HiddenFor(m => m.Patient.PatientId)
    @Html.HiddenFor(m => m.PatientDetails.PatientId)
    @Html.HiddenFor(m => m.PatientDetails.InitialAssesmentPatientId)
    @Html.HiddenFor(m => m.PatientDetails.DetailedAssesmentPatientId)
    @Html.HiddenFor(m => m.PatientDetails.InvestigationPatientId)
    @Html.HiddenFor(m => m.PatientDetails.TreatmentPatientId)
    @Html.HiddenFor(m => m.PatientDetails.SynopsisPatientId)
    <div id="tabs">
        <ul>
            <li><a href="#tabs-basic">Basic Details</a></li>
            <li><a href="#tabs-primary">Primary Info</a></li>
            <li><a href="#tabs-initial">Initial Assesment</a></li>
            <li><a href="#tabs-detailed">Detailed Assesment</a></li>
            <li><a href="#tabs-report">Investigation</a></li>
            <li><a href="#tabs-treatment">Treatment</a></li>
            <li><a href="#tabs-synopsis">Synopsis</a></li>
        </ul>
        <div id="tabs-basic">
            @Html.Partial("PatientInfo")
        </div>
        <div id="tabs-primary">
            @Html.Partial("PatientDetails")
        </div>
        <div id="tabs-initial">
            @Html.Partial("InitialAssesment")
        </div>
        <div id="tabs-detailed">
            @Html.Partial("DetailedAssesment")
        </div>
        <div id="tabs-report">
            @Html.Partial("Investigation")
        </div>
        <div id="tabs-treatment">
            @Html.Partial("Treatment")
        </div>
        <div id="tabs-synopsis">
            @Html.Partial("Synopsis")
        </div>
    </div>
    <p>
        <input type="submit" value="Submit" />
    </p>    
    <div>
        @Html.ActionLink("Back to List", "Index")
    </div>
}
@section Scripts {
    @System.Web.Optimization.Scripts.Render("~/bundles/jqueryui")
    @System.Web.Optimization.Scripts.Render("~/bundles/jqueryval")
    @System.Web.Optimization.Styles.Render("~/Content/themes/base/css")
    <script type="text/javascript">
        $(function () {
            $("#tabs").tabs();

            //District Filter
            var $district = $("#district"),
                $taluk = $('#taluk'),
                $city = $('#city'),
                $cityoptions = $('#city option'),
                $talukoptions = $('#taluk option');

            $(document).ready(function () {
                $district.trigger('change');
                $taluk.trigger('change');
                $city.trigger('change');
            });
            
            $district.on("change", function () {
                $taluk.html($talukoptions.filter('option[districtid="' + $district.val() + '"]'));
            });

            $taluk.on("change", function () {
                $city.html($cityoptions.filter('option[talukid="' + $taluk.val() + '"]'));
            });
        });
    </script>


    <!--<script type="text/javascript">
        function OnlyNumeric(e) {
            if ((e.which < 48 || e.which > 57)) {
                if (e.which == 8 || e.which == 46 || e.which == 0) {
                    return true;
                }
                else {
                    return false;
                }
            }
        }
    </script> -->
}
